<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org"
      xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">

<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="role-form">
                <div class="select-list">
                    <ul>
                        <li>微信名称：<input type="text" name="wxName"/></li>
                        <li><a class="btn btn-primary btn-rounded btn-sm"
                               onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm"
                               onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>
        <div class="btn-group-sm hidden-xs" id="toolbar" role="group">
            <a class="btn btn-danger btn-del disabled"
               onclick="$.operate.removeAll()"
               shiro:hasPermission="system:wxTemplates:remove"> <i
                    class="fa fa-remove"></i> 删除
            </a>
        </div>

        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table" data-mobile-responsive="true"></table>
        </div>
    </div>
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
    var prefix = ctx + "system/wxSendMsgLog/";
    var removeFlag = [[${@permission.hasPermi('system:wxSendMsgLog:remove')}]];

    $(function () {

        var options = {
            url: prefix + "/list",
            removeUrl: prefix + "/remove",
            sortName: "sendTime", // 排序字段
            modalName: "微信发送日志",
            search: false,
            showExport: false,
            columns: [{
                checkbox: true
            },
                {
                    field: 'id',
                    visible: false
                },
                {
                    field: 'wxName',
                    title: '微信名称'
                },
                {
                    field: 'wxCode',
                    title: '微信号'
                },
                {
                    field: 'successNum',
                    title: '发送成功',
                    formatter: function (value) {
                        return '<span class="badge badge-primary">'+value+'</span>'
                    }
                },
                {
                    field: 'errorNum',
                    title: '发送失败',
                    formatter: function (value) {
                        return '<span class="badge badge-danger">'+value+'</span>'
                    }
                },
                {
                    field: 'sendTime',
                    title: '群发时间',
                },
                {
                    field: 'remark',
                    title: '备注',
                    formatter: function (value) {
                        if(value != null)   return '<span class="label label-default">'+value+'</span>'
                    }
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function (value, row) {
                        var actions = [];
                        actions.push('<a class="btn btn-danger btn-xs  ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a> ');
                        return actions.join('');
                    }
                }]

        };
        $.table.init(options);
    });
</script>
</body>
</html>